package com.camel.base.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.camel.core.enums.BaseEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @author camel
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum DataSource implements BaseEnum {
    /**/
    SYSTEM(0, "系统创建"),CTI(1, "CTI同步");

    @EnumValue
    private Integer value;

    private String desc;

    DataSource(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public BaseEnum getEnumByValue(Integer value) {
        for (DataSource e : DataSource.values()) {
            if(e.getValue().equals(value)) {
                return e;
            }
        }
        return null;
    }
}
